package com.gmq.chapter01.interrupt;

/**
 * Created by gmq on 2017/08/10.
 * 1.7.7
 *
 * @version 1.0
 * @since 2017/08/10 10:34
 */
public class SynchronizedObject {

    private String username = "a";
    private String password = "aa";

    synchronized public void printString(String username, String password) {
        try {
            this.username = username;
            Thread.sleep(1000);
            this.password = password;
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
